<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simpla Admin</title>
<include file="Admin:Resources" />

</head>
<body>
	<div id="body-wrapper"> 
		<div id="main-content"> 
			<div class="content-box">
				
				<div class="content-box-header">
					
					<h3>列表</h3>
					
					<ul id="my_tab">	
						
						<li>{$excel_btn}</li>
						<li>&nbsp;{$add_btn}</li>
					</ul>
					<div class="clear"></div>
				</div> 
				
				
				<div class="content-box-content">
					
					<table>
						<tr>
							<!--
							<td>ID</td>-->
							<td>排序</td>
							<td>分类名称
								
							</td>
							<td>缩略图</td>
							
							<td>模型</td>
							<td>模板</td>
							<td>模板</td>
						
							
							<td>操作</td>
						</tr>
					<?php
				
					foreach($cat_list as $val){ 
					
						$suoJin = str_repeat("|----",$val['deep']-1);
						$weight="";
						if(($val['deep']-1)==0){
							$weight="font-weight:600";
						}
						
						$suoJin_desc = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;",$val['deep']-1);
					?>
						<tr all_parent="{$val['all_parent']}" category_id="{$val['category_id']}" parent_id="{$val['parent_id']}"  class="cat_row" style="background:#FFF" >
							<!--
							<td>{$val['category_id']}</td>-->
							<td>{$val['category_sort']}</td>
							<td style="{$weight}">
								<span>{$suoJin}<?php echo getLangByKey2($language,$val['cat_name']); ?>
									<?php if (1){ ?>
									<br>
									<?php echo $suoJin_desc;?>
									
										<?php if($_SESSION['siteid']==1 && $_SESSION['lang']!='chinese') { ?>
											<font style="font-size:12px;color:#aaa">(<?php echo getLangByKey2($language,$val['cat_name'],'chinese'); ?>)</font>
										<?php }else{ ?>
											<font style="font-size:12px;color:#aaa">({$val['cat_name']})</font>

										<?php } ?>
									
									<?php } ?>
								</span>
								<!--
								<span class="expand" style="display:none;font-size:12px;cursor:pointer; color:red">展开↓</span>
								<span class="collapse"  style="display:none;cursor:pointer;font-size:12px;color:#57a000" >收起</span>-->
							</td>
							<td><img class="toBig" src="{$val['thumb']}" width='28' height='28' /></td>
							<td>{$val['module_talbe_name']}</td>
							<td style="font-size:12px;">
								首页模板:{$val['cate_tpl']}
								<br>列表模板:{$val['list_tpl']}
								
							</td>
							
							<td style="font-size:12px;">
								内容模板:{$val['show_tpl']}
								<br>单页模板:{$val['single_tpl']}
							</td>
							
							<td>
							<if condition="$val['deep'] neq 1"></if>
								<!--
								<a href="__APP__/Content/module2actions/category_id/{$val['category_id']}">内容管理</a>&nbsp;|
								-->
								<a href="__APP__/Category/Category_edit/category_id/{$val['category_id']}">编辑</a>&nbsp;|
								<a href="__APP__/Category/Category_del/category_id/{$val['category_id']}">删除</a>
							</td>
						</tr>
					<?php } ?>
					</table>
				</div> 
				
			</div>
		<div class="clear"></div>
			
		</div> 
</div>
<script type="text/javascript">
	$(document).ready(function(){
	
		var cat_row = $('.cat_row');
		for(var i=0; i < cat_row.length; i++){
			var flag = false;
			var cat_id    = cat_row.eq(i).attr('category_id');
			for(var j=i; j < cat_row.length; j++){
				
				var all_parent = cat_row.eq(j).attr('all_parent');
				var parent_arr  = all_parent.split("-");
				for(var k=0;k<parent_arr.length;k++){
					if(cat_id==parent_arr[k]){
						flag = true;
					}
				}
			}
			if(flag){
				cat_row.eq(i).find('.collapse').show();
			}
		}
	
		$('.collapse , .expand ').click(function(){
			var cat_id    = $(this).parent().parent().attr('category_id');
			var parent_id = $(this).parent().parent().attr('parent_id');
			//alert(cat_id+'-'+parent_id)
			//alert(.length)
			var cat_row = $('.cat_row');
			for(var i=0; i < cat_row.length; i++){
				var flag = false;
				var all_parent = cat_row.eq(i).attr('all_parent');
				var parent_arr  = all_parent.split("-");
				for(var j=0;j<parent_arr.length;j++){
					if(cat_id==parent_arr[j]){
						flag = true;
					}
				}
				
				if(flag){
					
					
					if($(this).hasClass('collapse')){
						cat_row.eq(i).fadeOut();
						$(this).parent().find('.expand').show();
					}else{
						cat_row.eq(i).fadeIn();
						$(this).parent().find('.collapse').show();
					}
					
				}
			}
			
			
			
			$(this).hide();
			
		});
	})
</script>
	
</body>
</html>
